<?php 
include '../include/init.php';
include '../include/common.fun.php';
include '../include/mysql.config.php';

islogin();

if($_POST){
	dump($_POST);
	$title = $_POST['title'];
	$author = $_POST['author'];
	$order = $_POST['order']?$_POST['order']:0;
	$content = $_POST['editorValue'];
	$arr = array(
			'service_title' => $title,
			'service_author' => $author,
			'service_order' => $order,
			'service_content' => $content,
			'service_addtime' => time()
		);
	if($_FILES){
		$res1 = upload('img1','../uploads/service');
		$res2 = upload('img2','../uploads/service');
		$arr['service_img'] = $res1['path'];
		$arr['service_img2'] = $res2['path'];

		$result = $db->insert('wd_service',$arr);
		if($result){
			alert('添加成功','service_list.php');exit;
		}else{
			alert('添加失败');exit;
		}
	}
}



include "view/service_add.php";
